﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clipper.Model
{
    public class CmdModel
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="canId">CanID</param>
        /// <param name="cmd">命令</param>
        public CmdModel(short canId,string cmd)
        {
            CanId = canId;
            Cmd = cmd;
        }

        /// <summary>
        /// 命令发出之前要先发的参数命令
        /// </summary>
        public CmdModel NumberCmd
        {
            get;
            set;
        }
        /// <summary>
        /// 通过canID和命令一部分区别唯一
        /// </summary>
        public string CanIdCmdKey
        {
            get
            {
                string cmdIdKey;
                if (Cmd.Length < 5)
                {
                    cmdIdKey = CanId + Cmd.Substring(0, 2);
                }
                else
                {
                    cmdIdKey = CanId + Cmd.Substring(0, 3);
                }
                return cmdIdKey;
            }
        }
        public short CanId
        {
            get;
            set;
        }
        public string Cmd
        {
            get;
            set;
        }
    }
}
